perm filename WINGS.NEW[GEM,BGB] blob sn#049887 filedate 1973-06-21 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00015 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00004 00002	TITLE WINGS  -  THE WINGED EDGE SUBROUTINES  -  JULY 1972.
 00005 00003	SUBR(MKWORLD)-----------------------------------------------------
 00007 00004	SUBR(MKCAMERA) ---------------------------------------------------
 00009 00005	SUBR(MKB)BODY OR WORLD OR 0 --------------------------------------
 00011 00006	SUBR(MKF)BODY ----------------------------------------------------
 00013 00007	SUBR(KLF)B,FNEW --------------------------------------------------
 00015 00008	SUBR(WING)E1,E2---------------------------------------------------
 00017 00009	SUBR(LINKED)Q1,Q2 ------------------------------------------------
 00020 00010	INTERN ERIGHT,ELEFT-----------------------------------------------
 00022 00011	SUBR(ECW)FEV,FV --------------------------------------------------
 00024 00012	SUBR(OTHER)E,Q----------------------------------------------------
 00026 00013	SUBR(BGET)BFEVY --------------------------------------------------
 00028 00014	SUBR(BDET)B ------------------------------------------------------
 00030 00015	SUBR(VCW)EDGE,FACE -----------------------------------------------
 00033 ENDMK
⊗;
TITLE WINGS  -  THE WINGED EDGE SUBROUTINES  -  JULY 1972.

	EXTERN MKNODE,KLNODE,UNIVERSE
	INTERN BTOTAL,FTOTAL,ETOTAL,VTOTAL
	DECLARE{BTOTAL,FTOTAL,ETOTAL,VTOTAL}
	DECLARE{WORLD}
	INTERN WORLD	;FOR THE LOU PAUL KLUDGE.
SUBR(MKWORLD)-----------------------------------------------------
BEGIN MKWORLD; MAKE A WORLD NODE.

	SETQ(WORLD,{MKNODE,[PBIT+$WORLD]})
	CW. 1,1↔CCW. 1,1		;EMPTY BODY RING.
	CALL(MKFRAME)			;WORLD FRAME OF REFERENCE.
	LAC 2,WORLD
	FRAME. 1,2
	CALL(BATT,WORLD,UNIVERSE)	;PLACE WORLD IN UNIVERSE.
	LAC 1,WORLD
	POP0J

BEND MKWORLD; BGB 12 MARCH 1973 ----------------------------------


SUBR(MKWINDOW) ---------------------------------------------------
BEGIN MKWINDOW; MAKE A WINDOW NODE.

	SETQ(WINDOW#,{MKNODE,[PBIT+$WINDOW]})
	LAC[3.5]↔DAC -1(1)			;MAG
	LAC[XWD -=511,=511]↔DAC 1(1)		;XWD XL,,XH
	LAC[XWD -=384,=384]↔DAC 2(1)		;XWD YL,,YH
	CALL(BATT,WINDOW,UNIVERSE)
	LAC 1,WINDOW
	POP0J

BEND MKWINDOW; BGB 12 MARCH 1973 ---------------------------------


SUBR(MKFRAME)-----------------------------------------------------
BEGIN MKFRAME; MAKE A FRAME OF REFERENCE NODE.
	CALL(MKNODE,[1.0])
	SLACI(<1.0>)
	DAC IX(1)
	DAC JY(1)
	DAC KZ(1)
	POP0J
BEND MKFRAME; BGB 13 MARCH 1973 ----------------------------------
SUBR(MKCAMERA) ---------------------------------------------------
BEGIN MKCAMERA; MAKE A CAMERA NODE.

	SETQ(CAMERA#,{MKNODE,[PBIT+$CAMERA]})

;DEFAULT PHYSICAL RASTER SIZE.
	DEFINE MM{3.2808E-3}
	LAC[0.1739109E-1]↔DAC 1(1)	;PDX.
	LAC[0.1314883E-1]↔DAC 2(1)	;PDY.
	LAC[0.4101E-1]↔DAC 3(1)		;FOCAL

;DEFAULT LOCIGAL RASTER SIZE.
	LACI =144↔DAP 1(1)		;LDX
	LACI =108↔DAP 2(1)		;LDY
	LACI =100000↔DAP 3(1)		;LDZ

	LAC[-339.57]↔DAC -3(1)		;SCALEX
	LAC[-336.84]↔DAC -2(1)		;SCALEY
	LAC[4101.00]↔DAC -1(1)		;SCALEZ

;CAMERA LOCUS AND ORIENTATION.

	CALL(MKFRAME)
	LAC[16.0]↔DAC ZWC(1)		;16 FEET ABOVE XY PLANE.
	LAC 2,CAMERA↔FRAME. 1,2

	CALL(BATT,CAMERA,UNIVERSE)
	LAC 1,CAMERA
	POP0J
BEND MKCAMERA; BGB 12 MARCH 1973 ---------------------------------
SUBR(MKB)BODY OR WORLD OR 0 --------------------------------------
BEGIN MKB; MAKE BODY IN WORLD Q OR WORLD OF Q.
	AOS BTOTAL↔CALL(MKNODE,{[BBIT+PBIT+$BODY]})    ;CREATE NODE.
	DIP 1,1↔DAC 1,1(1)↔DAC 1,2(1)↔DAC 1,3(1)    ;FEV - RINGS.
	SKIPN 3,ARG1↔LAC 3,WORLD
	TESTZ 3,BBIT↔CCW 3,3↔CW 2,3		    ;GET WORLD.
	CW. 1,3↔CCW. 3,1↔CCW. 1,2↔CW. 2,1	    ;WORLD RINGIN.
	CDR 1,1↔POP1J				    ;RETURN BNEW.
BEND;1/14/73------------------------------------------------------

SUBR(KLB)BNEW-----------------------------------------------------
BEGIN KLB; KILL A BODY NODE.
	B←1 ↔ X←2 ↔ Y←3
	LAC  B,ARG1
	CW  X,B↔CCW  Y,B		;DELETE FROM ALBODY RING.
	CW. X,Y↔CCW. Y,X
	CALL(KLNODE,B)
	SOS BTOTAL↔POP1J
BEND;1/13/73------------------------------------------------------

SUBR(KLBFEV)Q-----------------------------------------------------
BEGIN KLBFEV
	ACCUMULATORS{B,F,E,V}
	LAC B,ARG1
	SETQ(B,{BGET,B})
L1:	PFACE F,B↔CAME F,B↔GO[CALL KLF,B,F↔GO L1]
L2:	PED   E,B↔CAME E,B↔GO[CALL KLE,B,E↔GO L2]
L3:	PVT   V,B↔CAME V,B↔GO[CALL KLV,B,V↔GO L3]
	CALL KLB,B
	POP1J
BEND;1/13/73------------------------------------------------------
SUBR(MKF)BODY ----------------------------------------------------
BEGIN MKF; MAKE FACE NODE.
	Q←1 ↔ X←2 ↔ B←3
	AOS FTOTAL↔CALL(MKNODE,{[FBIT+$FACE]})	;FACE NODE.
	PUSH P,X↔PUSH P,B
	LAC B,ARG3↔NFACE X,B↔PFACE. Q,X
	NFACE. Q,B↔PFACE. B,Q↔NFACE. X,Q	;RINGIN.
	POP P,B↔POP P,X↔POP1J
BEND MKF; BGB 1/13/73 --------------------------------------------

SUBR(MKE)BODY ----------------------------------------------------
BEGIN MKE; MAKE EDGE NODE.
	Q←1 ↔ X←2 ↔ B←3
	AOS ETOTAL↔CALL(MKNODE,{[EBIT+$EDGE]})	;EDGE NODE.
	PUSH P,X↔PUSH P,B
	LAC B,ARG3↔NED X,B↔PED. Q,X
	NED. Q,B↔PED. B,Q↔NED. X,Q		;RINGIN.
	CCW. B,Q
	POP P,B↔POP P,X↔POP1J
BEND MKE; 1/13/73 ------------------------------------------------

SUBR(MKV)BODY ----------------------------------------------------
BEGIN MKV; MAKE VERTEX NODE.
	Q←1 ↔ X←2 ↔ B←3
	AOS VTOTAL↔CALL(MKNODE,{[VBIT+$VERT]})	;VERTEX NODE.
	PUSH P,X↔PUSH P,B
	LAC B,ARG3↔NVT X,B↔PVT. Q,X
	NVT. Q,B↔PVT. B,Q↔NVT. X,Q		;RINGIN.
	POP P,B↔POP P,X↔POP1J
BEND MKV; 1/13/73 ------------------------------------------------
SUBR(KLF)B,FNEW --------------------------------------------------
BEGIN KLF; KILL FACE NODE.
	X←2 ↔ Y←B←3
	LAC 1,ARG1↔PUSH P,2↔PUSH P,3
	NFACE  X,1↔PFACE  Y,1		;DELETE FROM FACE RING.
	NFACE. X,Y↔PFACE. Y,X
	CALL(KLNODE,1)
	SOS FTOTAL			;DECREMENT THE COUNTERS.
	POP P,3↔POP P,2↔POP2J
BEND;1/13/73------------------------------------------------------

SUBR(KLE)B,ENEW --------------------------------------------------
BEGIN KLE; KILL EDGE NODE.
	X←2 ↔ Y←B←3
	LAC 1,ARG1↔PUSH P,2↔PUSH P,3
	NED  X,1↔PED  Y,1		;DELETE FROM EDGE RING.
	NED. X,Y↔PED. Y,X
	CALL(KLNODE,1)
	SOS ETOTAL			;DECREMENT THE COUNTERS.
	POP P,3↔POP P,2↔POP2J
	POP2J
BEND;1/13/73------------------------------------------------------

SUBR(KLV)B,VNEW --------------------------------------------------
BEGIN KLV; KILL VERTEX NODE.
	X←2 ↔ Y←B←3
	LAC 1,ARG1↔PUSH P,2↔PUSH P,3
	NVT  X,1↔PVT  Y,1		;DELETE FROM VERTEX RING.
	NVT. X,Y↔PVT. Y,X
	CALL(KLNODE,1)
	SOS VTOTAL			;DECREMENT THE COUNTERS.
	POP P,3↔POP P,2↔POP2J
BEND;1/13/73------------------------------------------------------
SUBR(WING)E1,E2---------------------------------------------------
BEGIN WING;PLACE WING POINTERS BETWEEN TWO EDGES.
;THE AC-0 CONTROL BITS: 
;[0-NV2-NV1] [0-PV2-PV1] [0-NF2-NF1] [0-PF2-PF1].
	E1←3 ↔ E2←4
	SAVAC(4)↔SETZ↔CDR E1,ARG2↔CDR E2,ARG1

;FIND THE COMMON VERTEX.
;AC-1 ← (NV1,,PV1) ⊗ (NV2,,PV2) NN,,PP IN COMMON.
;AC-2 ← (PV1,,NV1) ⊗ (NV2,,PV2) PN,,NP IN COMMON.
	LAC 1,3(E1)↔MOVS 2,1↔XOR 1,3(E2)↔XOR 2,3(E2)
	TLNN 1,-1↔TRO 3000↔TRNN 1,-1↔TRO 0300
	TLNN 2,-1↔TRO 2100↔TRNN 2,-1↔TRO 1200

;FIND THE COMMON FACE.
	LAC 1,1(E1)↔MOVS 2,1↔XOR 1,1(E2)↔XOR 2,1(E2)
	TLNN 1,-1↔TRO 0030↔TRNN 1,-1↔TRO 0003
	TLNN 2,-1↔TRO 0021↔TRNN 2,-1↔TRO 0012

;STORE THE WINGS AS INDICATED.
	SETCA
	TRNN 2020↔NCW.  E1,E2↔TRNN 1010↔NCW.  E2,E1
	TRNN 2002↔PCCW. E1,E2↔TRNN 1001↔PCCW. E2,E1
	TRNN 0220↔NCCW. E1,E2↔TRNN 0110↔NCCW. E2,E1
	TRNN 0202↔PCW.  E1,E2↔TRNN 0101↔PCW.  E2,E1
	GETAC(4)↔POP2J
BEND;1/13/73------------------------------------------------------
SUBR(LINKED)Q1,Q2 ------------------------------------------------
BEGIN LINKED; DETERMINE WHETHER TWO FEV ENTITIES ARE LINKED.
	ACCUMULATORS{Q1,Q2,E}
	CDR Q1,ARG2↔CDR Q2,ARG1

;BRANCH ON THE COMBINATION OF ARGUMENT TYPES.
	LDB 0,[POINT 3,(Q1),16]↔LDB 1,[POINT 3,(Q2),16]
	CAMLE 0,1↔EXCH Q1,Q2
	IOR 1,0↔GO@[FALSE↔FF↔EE↔FE↔VV↔FV↔EV↔FALSE](1)

;FACES WITH COMMON EDGE.
FF:	PED E,Q1↔DAC E,E0#
	CALL OTHER,E,Q1↔CAMN 1,Q2↔GO TRUE
	SETQ(E,{ECCW,E,Q1})↔CAME E,E0↔GO FF+2↔GO FALSE

;EDGE IN FACE PERIMETER.
FE:	PFACE 1,Q2↔CAMN 1,Q1↔GO TRUE
   	NFACE 1,Q2↔CAMN 1,Q1↔GO TRUE↔GO FALSE

;VERTEX IN FACE PERIMETER.
FV:	PED E,Q2↔DAC E,E0
	JUMPE E,[PFACE 1,Q1↔PVT 0,Q2↔CAME 0,1↔GO FALSE↔GO TRUE]
	PFACE 1,E↔CAMN 1,Q1↔GO TRUE↔NFACE 1,E↔CAMN 1,Q1↔GO TRUE
	SETQ(E,{ECCW,E,Q2})↔CAME E,E0↔GO FV+2↔GO FALSE

;EDGES WITH A COMMON VERTEX.
EE:	PVT 0,Q1↔PVT 1,Q2↔CAMN 0,1↔GO TRUE
                 NVT 1,Q2↔CAMN 0,1↔GO TRUE
        NVT 0,Q1↔PVT 1,Q2↔CAMN 0,1↔GO TRUE
                 NVT 1,Q2↔CAMN 0,1↔GO TRUE↔GO FALSE

;VERTEX IN EDGE.
EV:	PVT 1,Q1↔CAMN 1,Q2↔GO TRUE
        NVT 1,Q1↔CAMN 1,Q2↔GO TRUE↔GO FALSE

;VERTICES WITH A COMMON EDGE.
VV:	PED E,Q1↔DAC E,E0
	CALL OTHER,E,Q1↔CAMN 1,Q2↔GO TRUE
	SETQ(E,{ECCW,E,Q1})↔CAME E,E0↔GO VV+2↔GO FALSE

FALSE:	SETZ 1,↔POP2J
TRUE: 	SETO 1,↔POP2J
	LIT↔VAR
BEND;1/13/73------------------------------------------------------
INTERN ERIGHT,ELEFT-----------------------------------------------
ERIGHT:	TDZA 1,1	;E ← ERIGHT(FROM-V,ABOUT-F).
ELEFT:	SETO 1,		;E ← ELEFT(FROM-V,ABOUT-F).
BEGIN EFETCH
	ACCUMULATORS{V,F,E1,E2}
	Q←←1
	SAVAC(5)
	DAC Q,QFLAG#↔LAC V,ARG2↔LAC F,ARG1
	TEST V,VBIT↔GO[SETCMM QFLAG↔EXCH F,V↔GO .+1]
	PED E2,V↔DAC E2,E0#
L1:	LAC E1,E2

;E2←ECW(E1,V) AND Q←FCW(E1,V).
	PVT Q,E1↔CAME Q,V↔GO .+4
	NCCW E2,E1↔NFACE Q,E1↔GO .+6
	NVT Q,E1↔CAME Q,V↔GO[FATAL(EFETCH1)]
	PCCW E2,E1↔PFACE Q,E1
	CAMN Q,F↔GO L2
	CAME E2,E0↔GO L1
	FATAL(EFETCH2)
L2:	LAC 1,E1↔SKIPE QFLAG↔LAC 1,E2
	GETAC(5)↔POP2J
COMMENT .		V		EDGE FETCH MANDALA
		       / \
	  	      /   \
	  	     /     \
               ELEFT    F    ERIGHT
		   /	     \
		  /           \					.
BEND;1/13/73------------------------------------------------------
SUBR(ECW)FEV,FV --------------------------------------------------
BEGIN ECW; FETCH EDGE CLOCKWISE FROM FEV ABOUT FV.
	Q←1 ↔ X←2 ↔ E←3
	CDR 1,ARG2↔TEST 1,EBIT↔GO ERIGHT
	DAC 2,AC2↔ DAC 3,AC3
	CDR X,ARG1↔LAC E,1
	TEST  X,VBIT↔GO[
	PFACE Q,E↔CAME Q,X↔GO L1↔	PCW  Q,E↔GO L
L1:	NFACE Q,E↔CAME Q,X↔GO DIE↔	NCW  Q,E↔GO L]
	PVT   Q,E↔CAME Q,X↔GO L2↔	NCCW Q,E↔GO L
L2:	NVT   Q,E↔CAME Q,X↔GO DIE↔	PCCW Q,E↔GO L
DIE: 	FATAL(ECW)
L: 	LAC 2,AC2↔ LAC 3,AC3↔ POP2J
	LIT
BEND;1/13/73------------------------------------------------------

SUBR(ECCW)FEV,FV -------------------------------------------------
BEGIN ECCW; FETCH EDGE COUNTER CLOCKWISE FROM FEV ABOUT FV.
	Q←1 ↔ X←2 ↔ E←3
	CDR 1,ARG2↔TEST 1,EBIT↔GO ELEFT
	DAC 2,AC2↔ DAC 3,AC3
	CDR X,ARG1↔LAC E,1
	TEST  X,VBIT↔GO[
	PFACE Q,E↔CAME Q,X↔GO L1↔	PCCW  Q,E↔GO L
L1:	NFACE Q,E↔CAME Q,X↔GO DIE↔	NCCW  Q,E↔GO L]
	PVT   Q,E↔CAME Q,X↔GO L2↔	PCW Q,E↔GO L
L2:	NVT   Q,E↔CAME Q,X↔GO DIE↔	NCW Q,E↔GO L
DIE: 	FATAL(ECCW)
L: 	LAC 2,AC2↔ LAC 3,AC3↔ POP2J
	LIT
BEND;1/13/73------------------------------------------------------
SUBR(OTHER)E,Q----------------------------------------------------
BEGIN OTHER
	Q←←1↔X←←2↔E←←3
	DAC 2,AC2↔DAC 3,AC3
	CDR X,ARG1↔CDR E,ARG2
	TEST X,FBIT↔GO L1

;OTHER FACE OF THE EDGE.
	PFACE Q,E↔CAME Q,X↔GO .+3↔NFACE Q,E↔GO .+5
	NFACE Q,E↔CAME Q,X↔GO[FATAL({OTHER FACE})]
	PFACE Q,E↔LAC 2,AC2↔LAC 3,AC3↔POP2J

;OTHER VERTEX OF THE EDGE.
L1:	PVT Q,E↔CAME Q,X↔GO .+3↔NVT Q,E↔GO .+5
	NVT Q,E↔CAME Q,X↔GO[FATAL({OTHER VERTEX})]
	PVT Q,E↔LAC 2,AC2↔LAC 3,AC3↔POP2J
	LIT
BEND;1/13/73------------------------------------------------------

SUBR(OTHER.)Q,E,X-------------------------------------------------
BEGIN OTHER.
	Q←←1↔X←←2↔E←←3
	DAC 2,AC2↔DAC 3,AC3
	CDR X,ARG1↔CDR E,ARG2↔CDR Q,ARG3
	TEST X,VBIT↔GO[
	PFACE 0,E↔CAME 0,X↔GO L1↔NFACE. Q,E↔GO L
L1:	NFACE 0,E↔CAME 0,X↔GO DIE↔PFACE. Q,E↔GO L]
	NVT 0,E↔CAME 0,X↔GO L2↔PVT. Q,E↔GO L
L2:	PVT 0,E↔CAME 0,X↔GO DIE↔NVT. Q,E↔GO L
DIE: 	FATAL(OTHER.)
L:	LAC 2,AC2↔LAC 3,AC3
	POP3J↔LIT
BEND;1/13/73------------------------------------------------------
SUBR(BGET)BFEVY --------------------------------------------------
BEGIN BODY; FETCH THE BODY OF A BODY, FACE, EDGE, VERTEX OR YNODE.
	Q←1
COMMENT ⊗	OLDE CODE
	CDR Q,ARG1
	TESTZ Q,BBIT
	POP1J				;Q'S ALREADY A BODY.
	TESTZ Q,EBIT
L1:	GO [CCW Q,Q↔POP1J]		;Q WAS AN EDGE.
	TESTZ Q,FBIT
	GO [PFACE 0,Q↔PED Q,Q↔JUMPN Q,L1↔GO L2] ;FACE
	TESTZ Q,VBIT
	GO [PVT   0,Q↔PED Q,Q↔JUMPN Q,L1↔GO L2] ;VERTEX
	POP1J; Q AIN'T GOT NO BODY.
L2:	LAC 1,0↔POP1J			;VERTEX BODY CASE.
⊗;

	CDR Q,ARG1
L1:	LAC 0,(Q)
	TLNE 0,1B9
	POP1J				;FRAMES LOSE QUICKLY
	ANDI 0,17
	ADD 0,[@TABLE]
	GO @0
TABLE:	POP1J.↔POP1J.↔POP1J.↔POP1J.	;FRAME,EMTPY,UNIVERSE,LAMP
	POP1J.↔POP1J.↔POP1J.↔POP1J.	;CAMERA,WORLD,WINDOW,IMAGE
	[TCW Q,Q↔GO L1]↔POP1J.		;TEXT,XNODE
	[NY Q,Q↔GO L1]↔POP1J.		;YNODE,ZNODE
	POP1J.↔[PFACE 0,Q↔GO L2]	;BODY,FACE
	[CCW Q,Q↔POP1J]↔[PVT 0,Q↔GO L2]	;EDGE,VERTEX

L2:	PED Q,Q↔JUMPN Q,[CCW Q,Q↔POP1J]↔LAC 1,0↔POP1J
	LIT
BEND;1/13/73------------------------------------------------------
SUBR(BDET)B ------------------------------------------------------
BEGIN BDET; BODY DETACH - BGB - 17 FEBRUARY 1973.
	LAC 1,ARG1↔TESTZ 1,FBIT+EBIT+VBIT↔POP1J
	BRO 2,1↔SIS 3,1
	BRO. 2,3↔SIS. 3,2	;RINGO.
	CAMN 2,1↔SETZ 2,
	DAD 3,1↔SON 0,3
	CAMN 0,1↔SON. 2,3	;DAD OUT.
	SETZ↔DAD. 0,1
	BRO. 0,1↔SIS. 0,1	;CLEAR SELF.
	POP1J
BEND;2/17/73------------------------------------------------------

SUBR(BATT)B1,B2 --------------------------------------------------
BEGIN BATT; BODY ATTACH B1 TO B2 - BGB - 17 FEBRUARY 1973.
	LAC 1,ARG2↔LAC 2,ARG1↔CAMN 1,2↔POP2J
	$TYPE 0,2↔CAIN 0,$WINDOW↔GO[	;SPECIAL WINDOW CASES.
	$TYPE 0,1↔CAIN 0,$CAMERA↔GO[ALT. 1,2↔POP2J]
	CAIE 0,$IMAGE↔CAIN 0,$WORLD↔GO[ALT2. 1,2↔POP2J]↔GO .+1]
	TESTZ 1,FBIT+EBIT+VBIT↔POP2J
	DAD 0,1
	JUMPN[CALL(BDET,1)↔GO .+1]	;MAKE B1 AN ORPHAN.
	LAC 2,ARG1
	TESTZ 2,FBIT+EBIT+VBIT↔POP2J
	DAD. 2,1			;B2 IS B1'S NEW DADDY.
	SON 3,2↔JUMPE 3,[SON. 1,2
	BRO. 1,1↔SIS. 1,1↔POP2J]	;FIRST CHILD CASE.
	BRO 2,3
	BRO. 2,1↔SIS. 1,2		;MANY CHILD CASE.
	SIS. 3,1↔BRO. 1,3
	POP2J
BEND;2/17/73------------------------------------------------------
SUBR(VCW)EDGE,FACE -----------------------------------------------
BEGIN VCW; FETCH VERTEX CLOCKWISE FROM EDGE ABOUT FACE.
	Q←1↔E←2
	DAC 2,AC2↔CDR E,ARG2
	PFACE Q,E↔CAME Q,ARG1↔GO .+3↔PVT Q,E↔GO L
	NFACE Q,E↔CAME Q,ARG1↔GO[FATAL(VCW)]↔NVT Q,E
L:	LAC 2,AC2↔POP2J↔LIT
BEND VCW; BGB 1/13/73 --------------------------------------------

SUBR(VCCW)EDGE,FACE ----------------------------------------------
BEGIN VCCW; FETCH VERTEX COUNTER-CLOCKWISE FROM EDGE ABOUT FACE.
	Q←1↔E←2
	DAC 2,AC2↔CDR E,ARG2
	PFACE Q,E↔CAME Q,ARG1↔GO .+3↔NVT Q,E↔GO L
	NFACE Q,E↔CAME Q,ARG1↔GO[FATAL(VCCW)]↔PVT Q,E
L:	LAC 2,AC2↔POP2J↔LIT
BEND VCCW; BGB 1/13/73 -------------------------------------------

SUBR(FCW)EDGE,VERTEX ---------------------------------------------
BEGIN FCW; FETCH FACE CLOCKWISE FROM EDGE ABOUT VERTEX.
	Q←1↔E←2
	DAC 2,AC2↔CDR E,ARG2
	PVT Q,E↔CAME Q,ARG1↔GO .+3↔NFACE Q,E↔GO L
	NVT Q,E↔CAME Q,ARG1↔GO[FATAL(FCW)]↔PFACE Q,E
L:	LAC 2,AC2↔POP2J↔LIT
BEND FCW; BGB 1/13/73 --------------------------------------------

SUBR(FCCW)EDGE,VERTEX --------------------------------------------
BEGIN FCCW; FETCH FACE COUNTER-CLOCKWISE FROM EDGE ABOUT VERTEX.
	Q←1↔E←2
	DAC 2,AC2↔CDR E,ARG2
	PVT Q,E↔CAME Q,ARG1↔GO .+3↔PFACE Q,E↔GO L
	NVT Q,E↔CAME Q,ARG1↔GO[FATAL(FCCW)]↔NFACE Q,E
L:	LAC 2,AC2↔POP2J↔LIT
BEND FCCW; BGB 1/13/73 -------------------------------------------

END
WING.FAI - EOF.